package cuShapes;

import java.awt.*;

import palette.CurrentColor;


/**************************************************
*  CurrentShape is a "smart" shape that can tell
*    if it is a new shape or resizing a current shape
*  
*       CurrentShape is a Singleton
**************************************************/
public class CurrentShape {

	private static final long serialVersionUID = 1L;
	
	private static String selectedShape = "Arrow";
	//private static Rectangle workingRect = null;

	/**********************************************
	 *   CONSTRUCTORS
	**********************************************/
	protected CurrentShape(){
		
	}

	/**********************************************
	 *   Set currentShape to new instance of a
	 *     PQShape
	 *   This is called by the shape selection buttons. 
	 *     
	 * @param s String that is the name of the new 
	 *    shape to make. 
	 **********************************************/
	public static void setSelectedShape(String s) {
		selectedShape = s;
	}
	
	/*************************************************
	 *  This gets called when we are drawing a new shape
	 **************************************************/
	public static PQShape getSelectedShape(Point centerPoint){
		if (selectedShape.equals("Arrow")) {
			return new Arrow(centerPoint, CurrentColor.getInstance());
		}
		else if (selectedShape.equals("Box")) {
			return new Box(centerPoint, CurrentColor.getInstance());
		}
		else if (selectedShape.equals("Ellipse")) {
			return new Ellipse(centerPoint, CurrentColor.getInstance());
		}
		else{
			System.out.println(selectedShape +" is an unknown Shape" );
			return new Arrow(centerPoint, CurrentColor.getInstance());
		}
	}

}
